home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2381 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: erich.triumf.ca!bennett
  2. From: bennett@erich.triumf.ca (P.Bennett)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: HELP! #include <math.c> question
  5. Date: 20 Jan 1996 15:18 PST
  6. Organization: TRIUMF: Tri-University Meson Facility
  7. Distribution: world
  8. Message-ID: <20JAN199615183742@erich.triumf.ca>
  9. References: <Pine.SV4.3.91.960120135347.12016A-100000@larry>
  10. NNTP-Posting-Host: ftp.triumf.ca
  11. News-Software: VAX/VMS VNEWS 1.50    
  12.  
  13. In article <Pine.SV4.3.91.960120135347.12016A-100000@larry>, John Marsh <libjrm@emory.edu> writes...
  14. >Hi folks-
  15. >I'm trying to learn C, and have encountered a problem compiling a 
  16. >bit of code. I've tried it on two GNU compilers at different locations, 
  17. >and gotten the same error message. My code looks like this:
  18.  
  19. <...snippage...>
  20.  
  21. >When I try to compile it, I get an "Undefined symbol (sqrt) - Symbol 
  22. >referencing error" message. Shouldn't <math.h> recognize sqrt? I must be 
  23. >missing something, obviously, but I'm at a loss... Any help would be 
  24.  
  25. math.h just tells the _compiler_ what the math functions look like.  It doesn't
  26. tell the compiler where to find them.
  27.  
  28. For most unix systems, the math functions are in a separate library that you
  29. must explicitly list on the linker or compiler command line.  Just add "-lm" to
  30. the end of your present command.
  31.  
  32. (This problem doesn't occur in MS-DOS, where allmost all functions are in one
  33. library...)
  34.  
  35.  
  36.  
  37.  
  38.  
  39. Peter Bennett VE7CEI                | Vessels shall be deemed to be in sight
  40. Internet: bennett@triumf.ca         | of one another only when one can be
  41. Packet: ve7cei@ve7kit.#vanc.bc.ca   | observed visually from the other
  42. TRIUMF, Vancouver, B.C., Canada     |                          ColRegs 3(k)
  43. GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
  44.  
  45.